package Java面试周阳.LockSupport;

public class Demo01 {
    private static Object objectLock = new Object();
    public static void main(String[] args) {
        new Thread(() -> {
//            synchronized (objectLock) {
                System.out.println(Thread.currentThread().getName() + "---come in----");
                try {
                    objectLock.wait();
                } catch (Exception e) {
                    e.printStackTrace();
                }
                System.out.println(Thread.currentThread().getName() + "---被唤醒---");
//            }
        }, "t1").start();

        new Thread(() -> {
//            synchronized (objectLock) {
                objectLock.notify();
                System.out.println(Thread.currentThread().getName() + "---com in---");

//            }
        }, "t2").start();
    }
}
